// components/SearchInput/SearchInput.js
//Component Object
Component({
  properties: {
    //站点logo
    logo_src: { type: String, value: "" },
    //默认的搜索热词(placeholder)
    search_hot_word: { type: String, value: "" },
  },
  data: {
    navH: 0,
    keyword: "",
  },
  methods: {
    handleInput(e){
      this.setData({
        keyword:e.detail.value
      })
    },
    search() {
      let keyword = this.data.keyword || this.data.search_hot_word;
      this.triggerEvent("search", {keyword});
    },
  },
  lifetimes: {
    attached: function () {
      // 获取顶部栏信息
      wx.getSystemInfo({
        success: (res) => {
          //导航高度
          this.setData({
            navH: res.statusBarHeight + 46,
          });
        },
        fail(err) {
          console.log(err);
        },
      });
    },
  },
});
